import request from '@/utils/request.js'

// 用户注册服务
export const userRegisterService = (DataObj) => {
    return request.post('/users/register', JSON.stringify(DataObj), {
        headers: {
            'Content-Type': 'application/json'
        }
    });
};

// 密码登录服务
export const userLoginService = (loginData) => {
    return request.post('/users/login', JSON.stringify(loginData), {
        headers: {
            'Content-Type': 'application/json'
        }
    });
};

// 统一身份认证服务
export const authService = (DataObj) => {
    const url = '/users/authentication';
    return request.post(url, JSON.stringify(DataObj.requestBody), {
        headers: {
            'Content-Type': 'application/json'
        }
    });
};

// 修改密码服务
export const editService = (DataObj) => {
    return request.put('/users/updateInfo', JSON.stringify(DataObj), {
        headers: {
            'Content-Type': 'application/json'
        }
    });
};

// 发送短信验证码服务
export const sendService = (phoneNumber) => {
    console.log("phone=  ",phoneNumber)
    return request.post('/users/send/' + phoneNumber, null, {
        headers: {
            'Content-Type': 'application/json'
        }
    });
};

// 获取用户信息服务
export const getInfoService = (dataObj) => {
    return request.get(`/users/getuserinfo/${dataObj}`, {
        headers: {
            'Content-Type': 'application/json'
        }
    });
};

// 验证码登录服务
export const loginByCapService = (loginData) => {
    return request.post(`/users/loginByParam/${loginData.phoneNumber}/${loginData.param}`, JSON.stringify(loginData.param), {
        headers: {
            'Content-Type': 'application/json'
        }
    });
};

// 二维码登录服务 (这里假设你需要实现这个功能)
export const qrLoginService = (qrData) => {
    return request.post('/users/qrLogin', JSON.stringify(qrData), {
        headers: {
            'Content-Type': 'application/json'
        }
    });
};

// 用户查询单个记录服务 (这里假设你需要实现这个功能)
export const getUserRecordService = (userId) => {
    return request.get(`/users/record/${userId}`, {
        headers: {
            'Content-Type': 'application/json'
        }
    });
};